package com.telit.dispose.controller.dispose;

import com.telit.common.entity.DataReturn;
import com.telit.dispose.service.dispose.DataSelectPageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * Create by Chencf 2022/08/04
 */
@RestController
@RequestMapping("/api")
@Api(tags = "desc = 数据查询接口")
public class DataSelectPageController {

    @Autowired
    private DataSelectPageService dataSelectPageService;


    @GetMapping("/data")
    @ApiOperation("根据service查询不同的接口")
    public DataReturn dateSelectByService(@RequestParam(value = "tableId", required = false) String tableId,
                                          @RequestParam(value = "service", required = true) String service,
                                          @RequestParam(value = "current", required = false) Integer current,
                                          @RequestParam(value = "size", required = false) Integer size,
                                          @RequestParam(value = "name", required = false) String name,
                                          @RequestParam(value = "data", required = false) String data,
                                          @RequestParam(value = "detailId", required = false) String detailId,
                                          @RequestParam(value = "xzqhcode", required = false) String xzqhcode
    ) {
        Object result = dataSelectPageService.dateSelectByService(tableId, service, current, size, name, data, detailId,
                xzqhcode);
        return DataReturn.ok(result);
    }

}
